home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 July / Disc 1 / PCU0703CD1.iso / software / online / files / imacros.exe / EXTRACT-AND-FILL.VBS < prev    next >
Encoding:
Text File  |  2002-10-26  |  1.4 KB  |  46 lines

  1. 'Note: EXTRACT requires Internet Explorer 6.0 or better to be installed 
  2.  
  3. Msgbox ("This example shows how to use a data EXTRACTION and then fill the extracted data into a new form. It uses two macros for this purpose.")
  4.  
  5. dim ExchangeRate
  6.  
  7. set iim1= CreateObject ("iimwsh.iim")
  8.  
  9. iret = iim1.iimInit ()
  10. iret = iim1.iimDisplay("Extract Data")
  11. iplay = iim1.iimPlay("wsh-extract")
  12. data = iim1.iimGetLastMessage()
  13.  
  14. 'Check for errors:
  15. If iplay = 1 Then
  16.     MsgBox "Done, but no data extracted. This case should not happen unless there is no EXTRACT command in the macro."
  17.     WScript.Quit(0)
  18. End If
  19.  
  20. If iplay < 0 Then
  21.     s = "The following error occurred: " +  vbCrLf + vbCrLf + data
  22.     MsgBox s
  23.     WScript.Quit(0)
  24. End If
  25.  
  26. 'Now prepare the extracted data for submission
  27. 'One could also add IF/THEN statements here to make descision based
  28. 'on extracted values.
  29.  
  30. ExchangeRate= Split(data, "[EXTRACT]")
  31. s = "Hello Jim,"  +vbCrLf + vbCrLf
  32. s = s + "Did you know? One US$ costs " + ExchangeRate(0) + " EURO or " + ExchangeRate(1) + " British Pounds (GBP)."
  33.  
  34. iret = iim1.iimDisplay("Submit extracted data")
  35. iret = iim1.iimSet ("-var_currency", s)
  36. iplay = iim1.iimPlay("wsh-extract-and-fill-part2")
  37.  
  38. If iplay < 0 Then
  39.     s = "The following error occurred: " +  vbCrLf + vbCrLf + iim1.iimGetLastMessage()
  40.     MsgBox s
  41. End If
  42.  
  43. iret = iim1.iimExit
  44.  
  45. WScript.Quit(0)
  46.